ShadowsViewGroup

Interface common to all current custom ViewGroups.

The groups are divided into two broad categories: Recycling and Regular.

Recycling groups:

  • ShadowsRecyclerView

  • ShadowsListView

  • ShadowsExpandableListView

  • ShadowsGridView

  • ShadowsStackView

Regular groups:

  • ShadowsChipGroup

  • ShadowsConstraintLayout

  • ShadowsCoordinatorLayout

  • ShadowsFrameLayout

  • ShadowsLinearLayout

  • ShadowsMaterialButtonToggleGroup

  • ShadowsMotionLayout

  • ShadowsRadioGroup

  • ShadowsRelativeLayout

The groups' main use is to allow the library's shadow properties to be set on Views through layout XML. To that end, they all recognize the following XML attributes that correspond to the interface properties:

  • app:childShadowsPlane

  • app:clipAllChildShadows

  • app:childOutlineShadowsColorCompat

  • app:forceChildOutlineShadowsColorCompat

  • app:ignoreInlineChildShadows

The first four are conveniences that allow the same value to be applied to each child View added during initialization.

The last one – ignoreInlineChildShadows – determines whether the group will take over the draw operations for Inline shadows. By default, Regular groups set this to false, so that all of the planes work as expected of the box; Recycling groups set it to true, to avoid modifying the native child routine for groups that redraw rapidly.

To help prevent confusion over the runtime behavior, these groups will set their properties on children only until the group first attaches to a Window. After that, the group's properties can no longer be modified, and any user-added Views will not have any shadow properties set automatically.

The Recycling groups used to have specialized behavior for the handling of shadow objects, but that behavior has now been expanded to work with all recycling-type Views, library or not, so the Recycling label mainly just serves to distinguish them from the Regular ones anymore. The only other difference is that Recycling groups set ignoreInlineChildShadows to true by default, as mentioned above.

The Regular groups recognize the following XML attributes on child elements:

  • app:shadowPlane

  • app:clipOutlineShadow

  • app:outlineShadowColorCompat

  • app:forceOutlineShadowColorCompat

The possible XML values correspond to the code values just as one would expect. For example:

<com.zedalpha.shadowgadgets.view.viewgroup.ShadowsFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"

app:ignoreInlineChildShadows="true">

<Button
android:id="@+id/translucent_button"

app:shadowPlane="inline"
app:clipOutlineShadow="true"
app:outlineShadowColorCompat="#FF0000"
app:forceOutlineShadowColorCompat="true" />

</com.zedalpha.shadowgadgets.view.viewgroup.ShadowsFrameLayout>

For the purposes of consistent behavior across all of the different ViewGroup types, these attributes will work properly only on Views with IDs that are unique within the ViewGroup.

Inheritors

Properties

Link copied to clipboard
Link copied to clipboard

A single color value to set on all children during initialization as their color compat value.

Link copied to clipboard

The ShadowPlane to set on all child Views as they're added during initialization.

Link copied to clipboard
abstract override var clipAllChildShadows: Boolean

If true, sets clipOutlineShadow=true on all child Views as they're added during initialization.

Link copied to clipboard

If true, sets forceOutlineShadowColorCompat=true on all child Views during initialization.

Link copied to clipboard
abstract override var ignoreInlineChildShadows: Boolean

Determines whether the group will take over the draw operations for Inline shadows.